# -*- coding:utf-8 -*-
# /tools.py    工具

import hashlib
import markdown


def sha512(s):
    res = hashlib.sha512()
    res.update(s.encode("utf-8"))
    return res.hexdigest()


def markdown_to_html(s):
    exts = ["markdown.extensions.extra",
            "markdown.extensions.codehilite",
            "markdown.extensions.tables",
            "markdown.extensions.toc"]
    return markdown.markdown(s, extensions = exts)
